<template>
	<view :class="[BackGround]" :style="[{'font-weight':Style,'font-family':Font,height:100 + '%',minHeight:height + 'px'}]">
		<cu-custom bgColor="bg-gradual-blue" isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">员工档案</view>
		</cu-custom>
		<sear-ch ref="search" :placeholder="placeholder" @clean="clean" @input="input" @remove="remove"></sear-ch>
		<screen-view ref="screen" @formSubmit="formSubmit" :isShow="false" :dateisShow="false" :searchisShow="false"
		 :screenisShow="true" :picker="picker"></screen-view>
		<view :class="['cu-list menu-avatar no-padding',BackGroundBox]" :style="{marginTop: 100 +'rpx',marginBottom:100 + 'rpx'}">
			<view class="cu-item" v-for="(items,sub) in deliverplan" :key="sub" @tap="PhoneCall(items)" v-show="items.isShow">
				<view class="cu-avatar round lg" :style="{'backgroundImage':'url(' + ip + '/image/UserImage/FaceImage/' + items.LPHOTO + ')'}"></view>
				<view class="content">
					<view class="text-grey">{{items.LPHONE}}<text class="text-abc">{{items.LPHONE}}</text>{{items.LUSERNAME}}</view>
					<view class="text-gray text-sm">
						{{items.lmobile}}
					</view>
				</view>
			</view>
		</view>
		<button-father :Position="'tb-fa-fixed'">
			<button class="cu-btn bg-gradual-blue lg shadow tb-flex cu-btn-new" @tap="jumpdetail">员工添加</button>
		</button-father>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	import {
		inputSearch
	} from "@/mixin/mixin.js"
	import {
		getselectReferList
	} from "@/service/selectList"
	import SearCh from '@/colorui/components/search.nvue'
	import ScreenView from '@/colorui/components/ScreenView.vue'
	import ButtonFather from '@/colorui/components/ButtonFather.vue'
	export default {
		mixins: [inputSearch],
		data() {
			return {
				height: this.screenHeight,
				placeholder: '名称',
				searchView: "LUSERNAME",
				picker: [],
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar,
				deliverplan: [],
			}
		},
		components: {
			SearCh,
			ScreenView,
			ButtonFather
		},
		computed: {
			...mapGetters([
				'Style', 'Font', 'BackGround', 'BackGroundBox'
			]),
			ip() {
				let ip = uni.getStorageSync('IP') || 'http://47.101.156.202'
				let port = uni.getStorageSync('PORT') || '8443'
				return ip + ':' + port
			}
		},
		onShow() {
			if (global.Return) {
				this.$refs.search.value = ''
				this.getusername()
			}
		},
		onUnload() {
			global.Return = false
		},
		onLoad() {
			this.getusername()
			this.selectDeitial()
		},
		methods: {
			getusername() {
				uni.showLoading({
					title: '加载中'
				});
				uni.request({
					url: uni.getStorageSync('IP') + ':' + uni.getStorageSync('PORT') + '/api/select',
					method: 'POST',
					dataType: 'json',
					header: {
						'content-type': 'application/json;charset=UTF-8',
						'token': uni.getStorageSync('token')
					},
					data: {
						lfuncno: 1005,
						startTime: '',
						endTime: '',
						strwhere: {},
					},
					success: (res) => {
						if (res.data.code === 1) {
							this.deliverplan = res.data.data
							uni.hideLoading();
						} else {
							uni.hideLoading();
						}
					},
					fail: (error) => {

					}
				})
			},
			async selectDeitial() {
				let picker = await getselectReferList(1005, '表头', 'LPLANTINDEX', {})
				if (picker.data.code === 1) {
					this.picker = picker.data.data
				}
			},
			formSubmit(e) {
				console.log(e);
				if (e.LGENDER === 0) {
					e.LGENDER = '男'
				} else {
					e.LGENDER = '女'
				}
				for (let value of this.deliverplan) {
					console.log(value['LISDIMISSION']);
					if (value['LCLASSINDEX'].search(e.LCLASSINDEX) != -1 && value['LISDIMISSION'].search(e.LISDIMISSION) != -1 &&
						value['LGENDER'].search(e.LGENDER) != -1) {
						console.log(value);
						value.isShow = true
					} else {
						value.isShow = false
					}
				}
			},
			//人员添加
			jumpdetail() {
				uni.navigateTo({
					url: '../Personneladd/Personneladd'
				})
			},
			//拨打电话
			PhoneCall(e) {
				uni.navigateTo({
					url: `./Personnelinformationdetail?LID=${e.LID}`,
				});
			},
		}
	}
</script>

<style>
	.indexes {
		position: relative;
	}

	.indexBar {
		position: fixed;
		z-index: 10;
		right: 0px;
		bottom: 80rpx;
		padding: 20rpx 20rpx 20rpx 60rpx;
		display: flex;
		align-items: center;
	}

	.indexBar .indexBar-box {
		width: 40rpx;
		height: auto;
		background: #fff;
		display: flex;
		flex-direction: column;
		box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.1);
		border-radius: 10rpx;
	}

	.indexBar-item {
		flex: 1;
		width: 40rpx;
		height: 40rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 24rpx;
		color: #888;
	}

	movable-view.indexBar-item {
		width: 40rpx;
		height: 40rpx;
		z-index: 9;
		position: relative;
	}

	movable-view.indexBar-item::before {
		content: "";
		display: block;
		position: absolute;
		left: 0;
		top: 10rpx;
		height: 20rpx;
		width: 4rpx;
		background-color: #f37b1d;
	}

	.indexToast {
		position: fixed;
		z-index: 19;
		top: 0;
		right: 80rpx;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		width: 100rpx;
		height: 100rpx;
		border-radius: 10rpx;
		margin: auto;
		color: #fff;
		line-height: 100rpx;
		text-align: center;
		font-size: 48rpx;
	}

	.padding {
		position: sticky;
		top: 0;
		z-index: 9;
		background-color: #f1f1f1;
	}
</style>
